/**
  ******************************************************************************
  * @file   : uart.h
  * @author : 测试1组（houtiezhu）
  * @version: v0
  * @date   : 2019.07.09
  * @brief  :
  *
  * Copyright (C) 2019  Hangzhou SDIC Microelectronics Co., Ltd
  ******************************************************************************
**/

#ifndef FLASH_H
#define FLASH_H
#include "define.h"

//===============================EEP ADDR===================================
#define UserStartAddress    (0x08000000 + 1024 * 100)
#define 	CalBak				(UserStartAddress + 12 * 1024)
#define 	CalAdd				(UserStartAddress + 13 * 1024)
#define	 FunctionAdd		(UserStartAddress + 10 * 1024)
#define	 FunctionBak		(UserStartAddress + 11 * 1024)

#define	EEPROMCheckAdd			(UserStartAddress + 15 * 1024)//

#define valveoffsetAdd			(UserStartAddress + 14 * 1024)
#define	UserSetAdd				(UserStartAddress + 16 * 1024)//待定
#define	WorkModeAdd				(UserStartAddress + 17 * 1024)//待定
#define LifeTestAdd             ((UserStartAddress + 17 * 1024) + 512)//待定

//MemBack = 2k ,所以AB总数不能大于2K
#define	UserBOffSet		100//	256	  //2048/8=256


//============================================================================





extern	u8   	outbyte[8];
extern	uint8   MemoryIndex;
extern	uint8 	BPLevelType;
extern	uint8   Det_DIA;
extern	uint8   ResultDataS; 		 	//SYS
extern	uint8   ResultDataD; 		 	//DIA
extern	uint8   ResultDataH; 		 	//PUL
extern	uint8   ResultDataDA;		 	//day
extern	uint8   ResultDataHO;		 	//hour
extern	uint8   ResultDataMI;		 	//min
extern u32 MemBack[4096/4];

void	User_Uart0_Init(void);
void	CLRMemoryBank(void);
void	UserflashTest(void);
uint8	FLASH_PageErase(u32 AddrStart,u16 PageLength );
void	resultdata(void);
void	savefunction(void);
void	writeFULLmemorybank(void);
void	SaveSet(void);

void	writeM24L16(void);
void	readM24L16(void);

void	LoadMemory(void);
void	checkeeprom(void);
uint8	Byte_RDNO(uint32 MEM_ADDR);
void	Byte_WtNO(uint32 rom_addr,uint8 rom_data);
void	CheckMemDataIsOK(void);

void CheckEepromIsOk(void);
void MemTset(void);


void readM24L16addr(uint32 addr);
void writeM24L16addr(uint32 addr);


#endif



/************************ (C) COPYRIGHT Hangzhou SDIC Microelectronics *****END OF FILE****/
